﻿/*
#**************************************************************************
#  openSIS is a student information system for public and non-public 
#  schools from Open Solutions for Education, Inc. web: www.os4ed.com
#
#  openSIS is  web-based, open source, and comes packed with features that 
#  include student demographic info, scheduling, grade book, attendance, 
#  report cards, eligibility, transcripts, parent portal, 
#  student portal and more.   
#
#  Visit the openSIS web site at http://www.opensis.com to learn more.
#  If you have question regarding this system or the license, please send 
#  an email to info@os4ed.com.
#
#  This program is released under the terms of the GNU General Public License  
#  as  published by the Free Software Foundation, version 2 of the License. 
#  See license.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#**************************************************************************** 

*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OSISDynamicTranslation;
using System.Data;
using OSISStudentInfoDataLayer;

namespace OSISStudentInfoBusinessLayer
{
    public class StudentInfoBL
    {

        private int studentid;
        private int altid;
        private int studistid;
        private int stustid;
        private int stusttestid;
        private string fname;
        private string mname;
        private string lname;
        private string gender;
        private string ethnicity;
        private string commonname;
        private string ssn;
        private string stumedalertind;
        private string dob;
        private string lastupdated;
        private int stu504ind;
        private int language;
        private string graddate;
        private int hispanicind;
        private int stumedinfoid;
        private string stuemail;
        private int grade;
        private string calender;
        private string retentionoptions;
        private string uname;
        private string password;
        private string attendancestartdateofschool;
        private string startcdn;
        private int schoolid;
        private string schoolname;


        //******************

        private int stuenrid;
        private string enrstartdt;
        private string enrenddt;
        private string enrtitle1ind;
        private int nextschid;
        private int lastschid;
        private int schyrid;
        private string enrspedind;
        private int enrcdid;
        private string enrfreeredind;
        private string enrhmlsstsind;
        private string enrgiftedind;

        private int extrafieldid;

        private string suffix;

        private string customfieldvalue;
        private string fieldname;
        private int fieldid;
        private int catid;
        private int ethnicityid;
        private int countrycode;
        private int listitemid;
        private string enrollmentdate;
        private string stdschid;
        private string state;
        private string personrelid;
        private int setid;
        private int homefieldid;
        private string MLULCul;

        private static string langto;

        public StudentInfoBL()
        {
            homefieldid = 0;
            setid = 0;
            personrelid = "";
            state = "";
            stdschid = "";
            enrollmentdate = "";
            listitemid = 0;
            countrycode = 0;
            ethnicityid = 0;
            catid = 0;
            studentid = 0;
            fname = "";
            mname = "";
            lname = "";
            gender = "";
            ethnicity = "";
            commonname = "";
            ssn = "";
            dob = "";
            language = 0;
            graddate = "01/01/1900";
            altid = 0;
            grade = 0;
            calender = "";
            retentionoptions = "";
            uname = "";
            password = "";
            attendancestartdateofschool = "01/01/1900";
            startcdn = "";
            schoolid = 0;
            schoolname = "";

            studistid = 0;
            stustid = 0;
            stusttestid = 0;
            stumedalertind = "";
            lastupdated = "";
            stu504ind = 0;
            hispanicind = 0;
            stumedinfoid = 0;
            stuemail = "";

            //**********************

            stuenrid = 0;
            enrstartdt = "01/01/1900";
            enrenddt = "01/01/1900";
            enrtitle1ind = "";
            nextschid = 0;
            lastschid = 0;
            schyrid = 0;
            enrspedind = "";
            enrcdid = 0;
            enrfreeredind = "";
            enrhmlsstsind = "";
            enrgiftedind = "";

            extrafieldid = 0;
            suffix = "";
            customfieldvalue = "";
            fieldname = "";
            fieldid = 0;
            MLULCul = "";
        }

        public int HomeFieldId
        {
            get
            {
                return this.homefieldid;
            }
            set
            {
                this.homefieldid = value;
            }
        }
        public int SetId
        {
            get
            {
                return this.setid;
            }
            set
            {
                this.setid = value;
            }
        }
        public String PersonRelId
        {
            get
            {
                return this.personrelid;
            }
            set
            {
                this.personrelid = value;

            }
        }
        public String State
        {
            get
            {
                return this.state;
            }
            set
            {
                this.state = value;

            }
        }
        public String StdSchId
        {
            get
            {
                return this.stdschid;
            }
            set
            {
                this.stdschid = value;

            }
        }
        public String EnrollmentDate
        {
            get
            {
                return this.enrollmentdate;
            }
            set
            {
                this.enrollmentdate = value;

            }
        }
        public int ListItemId
        {
            get
            {
                return this.listitemid;
            }
            set
            {
                this.listitemid = value;
            }
        }
        public int CountryCode
        {
            get
            {
                return this.countrycode;
            }
            set
            {
                this.countrycode = value;
            }
        }
        public int EthnicityId
        {
            get
            {
                return this.ethnicityid;
            }
            set
            {
                this.ethnicityid = value;
            }
        }
        public int CatId
        {
            get
            {
                return this.catid;
            }
            set
            {
                this.catid = value;
            }
        }
        public int FieldId
        {
            get
            {
                return this.fieldid;
            }
            set
            {
                this.fieldid = value;
            }
        }
        public int ExtrafieldId
        {
            get
            {
                return this.extrafieldid;
            }
            set
            {
                this.extrafieldid = value;
            }
        }

        public int StudentID
        {
            get
            {
                return this.studentid;
            }
            set
            {
                this.studentid = value;
            }
        }
        public int SchoolID
        {
            get
            {
                return this.schoolid;
            }
            set
            {
                this.schoolid = value;
            }
        }
        public String SchoolName
        {
            get
            {
                return this.schoolname;
            }
            set
            {
                this.schoolname = value;

            }
        }
        public String FName
        {
            get
            {
                return this.fname;
            }
            set
            {
                this.fname = value;

            }
        }
        public String MName
        {
            get
            {
                return this.mname;
            }
            set
            {
                this.mname = value;

            }
        }
        public String LName
        {
            get
            {
                return this.lname;
            }
            set
            {
                this.lname = value;

            }
        }
        public string Gender
        {
            get
            {
                return this.gender;
            }
            set
            {
                this.gender = value;

            }
        }
        public string Ethnicity
        {
            get
            {
                return this.ethnicity;
            }
            set
            {
                this.ethnicity = value;

            }
        }
        public String CommonName
        {
            get
            {
                return this.commonname;
            }
            set
            {
                this.commonname = value;

            }
        }
        public String SSN
        {
            get
            {
                return this.ssn;
            }
            set
            {
                this.ssn = value;

            }
        }
        public String DOB
        {
            get
            {
                return this.dob;
            }
            set
            {
                this.dob = value;

            }
        }
        public int Language
        {
            get
            {
                return this.language;
            }
            set
            {
                this.language = value;

            }
        }
        public String GradDate
        {
            get
            {
                return this.graddate;
            }
            set
            {
                this.graddate = value;

            }
        }

        public int Grade
        {
            get
            {
                return this.grade;
            }
            set
            {
                this.grade = value;

            }
        }
        public String Calender
        {
            get
            {
                return this.calender;
            }
            set
            {
                this.calender = value;

            }
        }
        public String RetentionOptions
        {
            get
            {
                return this.retentionoptions;
            }
            set
            {
                this.retentionoptions = value;

            }
        }
        public String UName
        {
            get
            {
                return this.uname;
            }
            set
            {
                this.uname = value;

            }
        }
        public String Password
        {
            get
            {
                return this.password;
            }
            set
            {
                this.password = value;

            }
        }
        public String AttendaceStartDateOfSchool
        {
            get
            {
                return this.attendancestartdateofschool;
            }
            set
            {
                this.attendancestartdateofschool = value;

            }
        }
        public String StartCondition
        {
            get
            {
                return this.startcdn;
            }
            set
            {
                this.startcdn = value;

            }
        }

        public int AltID
        {
            get
            {
                return this.altid;
            }
            set
            {
                this.altid = value;
            }
        }

        public int StuDistID
        {
            get
            {
                return this.studistid;
            }
            set
            {
                this.studistid = value;
            }
        }

        public int StuStID
        {
            get
            {
                return this.stustid;
            }
            set
            {
                this.stustid = value;
            }
        }

        public int StuSttestID
        {
            get
            {
                return this.stusttestid;
            }
            set
            {
                this.stusttestid = value;
            }
        }

        public String StuMedAlertInD
        {
            get
            {
                return this.stumedalertind;
            }
            set
            {
                this.stumedalertind = value;

            }
        }

        public String LastUpdatedDate
        {
            get
            {
                return this.lastupdated;
            }
            set
            {
                this.lastupdated = value;

            }
        }

        public int Stu504InD
        {
            get
            {
                return this.stu504ind;
            }
            set
            {
                this.stu504ind = value;
            }
        }

        public int HispanicInD
        {
            get
            {
                return this.hispanicind;
            }
            set
            {
                this.hispanicind = value;
            }
        }

        public int StuMedinfoID
        {
            get
            {
                return this.stumedinfoid;
            }
            set
            {
                this.stumedinfoid = value;
            }
        }


        public String StuEmail
        {
            get
            {
                return this.stuemail;
            }
            set
            {
                this.stuemail = value;

            }
        }


        //*****************

        public String EnrStartDate
        {
            get
            {
                return this.enrstartdt;
            }
            set
            {
                this.enrstartdt = value;

            }
        }

        public String EnrEndDate
        {
            get
            {
                return this.enrenddt;
            }
            set
            {
                this.enrenddt = value;

            }
        }

        public String EnrTitle1InD
        {
            get
            {
                return this.enrtitle1ind;
            }
            set
            {
                this.enrtitle1ind = value;

            }
        }

        public int NextSchID
        {
            get
            {
                return this.nextschid;
            }
            set
            {
                this.nextschid = value;

            }
        }

        public int LastSchID
        {
            get
            {
                return this.lastschid;
            }
            set
            {
                this.lastschid = value;

            }
        }

        public int SchyrID
        {
            get
            {
                return this.schyrid;
            }
            set
            {
                this.schyrid = value;

            }
        }

        public String EnrSpedInD
        {
            get
            {
                return this.enrspedind;
            }
            set
            {
                this.enrspedind = value;

            }
        }

        public int EnrCdID
        {
            get
            {
                return this.enrcdid;
            }
            set
            {
                this.enrcdid = value;

            }
        }

        public String EnrFreeRedInd
        {
            get
            {
                return this.enrfreeredind;
            }
            set
            {
                this.enrfreeredind = value;

            }
        }

        public String EnrHmlsStsInD
        {
            get
            {
                return this.enrhmlsstsind;
            }
            set
            {
                this.enrhmlsstsind = value;

            }
        }

        public String EnrGiftedInD
        {
            get
            {
                return this.enrgiftedind;
            }
            set
            {
                this.enrgiftedind = value;

            }
        }


        public String Suffix
        {
            get
            {
                return this.suffix;
            }
            set
            {
                this.suffix = value;

            }
        }

        public String CustomfieldValue
        {
            get
            {
                return this.customfieldvalue;
            }
            set
            {
                this.customfieldvalue = value;

            }
        }
        public String FieldName
        {
            get
            {
                return this.fieldname;
            }
            set
            {
                this.fieldname = value;

            }
        }

        public String mlUICulture
        {
            get
            {
                return this.MLULCul;
            }
            set
            {
                this.MLULCul = value;

            }
        }

        public System.Data.DataTable populatestudentlistbyschoolid()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.StudentListBySchoolID(this);
            return dt;
        }

        public System.Data.DataTable GetFieldValueByCategory()
        {
            StudentInfoDL stinfo = new StudentInfoDL();
            DynamicTranslation DTL = new DynamicTranslation();
            langto = mlUICulture;
            try
            {
                DataTable dt = stinfo.GetFieldValueByCategory(this);
                if (MLULCul != "en")
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string origtext = dt.Rows[i]["FieldName"].ToString();
                        string trantext = DTL.Translate(origtext, "en", MLULCul);
                        dt.Rows[i]["FieldName"] = trantext;
                    }
                }
                return dt;
            }
            catch
            {
                DataTable dts = null;
                return dts;
            }
        }

        public System.Data.DataTable getdefaultaddressfields()
        {
            StudentInfoDL stinfo = new StudentInfoDL();
            DynamicTranslation DTL = new DynamicTranslation();
            langto = mlUICulture;
            DataTable dt = stinfo.GetDefaultAddressFields(this);
            if (MLULCul != "en")
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string origtext = dt.Rows[i]["FieldName"].ToString();
                    string trantext = DTL.Translate(origtext, "en", MLULCul);
                    dt.Rows[i]["FieldName"] = trantext;
                }
            }
            return dt;
        }

        public System.Data.DataTable getaddressfieldvalues()
        {
            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetAddressFieldValues(this);
            DynamicTranslation DTL = new DynamicTranslation();
            langto = mlUICulture;
            if (langto != "en")
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string origtext = dt.Rows[i]["FieldName"].ToString();
                    string trantext = DTL.Translate(origtext, "en", langto);
                    dt.Rows[i]["FieldName"] = trantext;
                }
            }
            return dt;
        }

        public System.Data.DataTable getfieldnamebyfieldid()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetFieldNameByFieldId(this);
            return dt;
        }

        public System.Data.DataTable GetSummaryFields()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DynamicTranslation DTL = new DynamicTranslation();
            langto = mlUICulture;
            DataTable dt = StdInfo.getsummaryfields(this);
            if (langto != "en")
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string origtext = dt.Rows[i]["field_name"].ToString();
                    string trantext = DTL.Translate(origtext, "en", langto);
                    dt.Rows[i]["field_name"] = trantext;
                }
            }
            return dt;
        }
        public System.Data.DataTable GetSummaryHeaderFields()
        {

            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.getsummaryheaderfields(this);


            DynamicTranslation DTL = new DynamicTranslation();
            langto = mlUICulture;


            if (langto != "en")
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string origtext = dt.Rows[i]["field_name"].ToString();

                    string trantext = DTL.Translate(origtext, "en", langto);
                    dt.Rows[i]["field_name"] = trantext;
                }
            }
            return dt;
        }
     
        


        public System.Data.DataTable getnextstudentid()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetNextStudentId(this);
            return dt;
        }

        public System.Data.DataTable getpreviousstudentid()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetPreviousStudentId(this);
            return dt;
        }

        public System.Data.DataTable getfirststudentidbyschoolid()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetFirstStudentIdBySchoolId(this);
            return dt;
        }
        public System.Data.DataTable getlaststudentidbyschoolid()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetLastStudentIdBySchoolId(this);
            return dt;
        }







        public System.Data.DataTable getcontroltype()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetControlType(this);
            return dt;
        }





        public System.Data.DataTable getethnicity()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetEthnicity(this);
            return dt;
        }


        public System.Data.DataTable getgender()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetGender(this);
            return dt;
        }


        public System.Data.DataTable getlanguage()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetLanguage(this);
            return dt;
        }
        public System.Data.DataTable getcountry()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetCountryName(this);
            return dt;
        }
        public System.Data.DataTable getcalendername()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetCalenderName(this);
            return dt;
        }
        public System.Data.DataTable getcustomlistitemname()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetCustomListItemName(this);
            return dt;
        }

        public System.Data.DataTable getphotoURL()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetPhotoURL(this);
            return dt;
        }
        public System.Data.DataTable getstartcondition()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetStartCondition(this);
            return dt;
        }

        public System.Data.DataTable getstatename()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetStateName(this);
            return dt;
        }

        public System.Data.DataTable getcontactrelationshipname()
        {

            StudentInfoDL stinfo = new StudentInfoDL();
            DataTable dt = stinfo.GetContactRelationshipName(this);
            return dt;
        }


        //public System.Data.DataTable getadditionalfieldvalues()
        //{

        //    StudentInfoDL stinfo = new StudentInfoDL();
        //    DataTable dt = stinfo.GetAdditionalFieldValues(this);
        //    return dt;
        //}

        public System.Data.DataTable PopulateAdditionalField()
        {

            StudentInfoDL stdl = new StudentInfoDL();
            DataTable dt = stdl.populateadditionalfield(this);

            DynamicTranslation DTL = new DynamicTranslation();
            langto = mlUICulture;

            if (langto != "en")
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string origtext = dt.Rows[i]["FieldName"].ToString();
                    string trantext = DTL.Translate(origtext, "en", langto);
                    dt.Rows[i]["FieldName"] = trantext;
                }
            }
            return dt;
        }


        public System.Data.DataTable PopulateAddressFields()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.populateaddressfields(this);
            return dt;

        }

        public System.Data.DataTable GetMedicalInfoFieldValue()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.getmedicalinfofieldvalue(this);
            return dt;

        }

        public System.Data.DataTable GetImmunizationFieldValue()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.getimmunizationfieldvalue(this);
            return dt;

        }

        public System.Data.DataTable GetMedicalAlertFieldValue()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.getmedicalalertfieldvalue(this);
            return dt;

        }

        public System.Data.DataTable GetNurseVisitFieldValue()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.getnursevisitfieldvalue(this);
            return dt;

        }

        public System.Data.DataTable GetVaccinationFieldValue()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.getvaccinationfieldvalue(this);
            return dt;

        }

        public DataTable Getstudentschoolenroll()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = null;
            dt = StdInfo.Getstudentschoolenroll(this);
            return dt;
        }

        public string GetdynamicallycreatedDataItems()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            string s = "";
            s = StdInfo.GetdynamicallycreatedDataItems(this);
            return s;
        }
        //special and gifted code starts here

        public System.Data.DataTable GetSpecialValues()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.GetSpecialValues(this);
            return dt;

        }

        public System.Data.DataTable GetGiftedValues()
        {
            StudentInfoDL StdInfo = new StudentInfoDL();
            DataTable dt = StdInfo.GetGiftedValues(this);
            return dt;

        }




    }
}
